package org.jeecg.modules.online.desform.service;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.MatchTypeEnum;
import org.jeecg.modules.online.desform.entity.DesignForm;
import org.jeecg.modules.online.desform.entity.DesignFormData;

import java.io.UnsupportedEncodingException;
import java.util.Collection;
import java.util.List;

/**
 * @Description: 表单设计数据
 * @Author: jeecg-boot
 * @Date: 2019-05-16
 * @Version: V1.0
 */
public interface IDesignFormDataService extends IService<DesignFormData> {

	/**
	 * 批量保存导入的数据
	 *
	 * @param designForm
	 * @param entityList
	 * @return
	 */
	boolean saveBatchByImport(DesignForm designForm, Collection<JSONObject> entityList, String token);

	/**
	 * 根据高级查询条件查询数据
	 *
	 * @param desformCode
	 * @param pageNo
	 * @param pageSize
	 * @param queryWrapper
	 * @param superQueryList
	 * @return
	 */
	public Result<IPage<DesignFormData>> pageList(String desformCode, int pageNo, int pageSize, QueryWrapper<DesignFormData> queryWrapper, JSONArray superQueryList, MatchTypeEnum matchType);


	/**
     * 根据高级查询条件查询数据（分页）
     *
     * @param desformCode
     * @param queryWrapper
     * @param superQuery
     * @param pageNo
     * @param pageSize
     * @param username
     * @return
     */
    Result<IPage<DesignFormData>> queryPage(String desformCode, int pageNo, int pageSize, QueryWrapper<DesignFormData> queryWrapper, String superQuery, String username) throws UnsupportedEncodingException;

    /**
     * 根据高级查询条件查询数据（不分页）
     *
     * @param desformCode
     * @param queryWrapper
     * @param superQuery
     * @param username
     * @return
     */
    Result<List<DesignFormData>> queryList(String desformCode, QueryWrapper<DesignFormData> queryWrapper, String superQuery, String username) throws UnsupportedEncodingException;

	/**
	 * 通过主表ID查询数据
	 *
	 * @param mainId
	 * @return
	 */
	public List<DesignFormData> selectByMainId(String mainId);

	/**
	 * 新增一条数据
	 *
	 * @param designFormData
	 * @return
	 */
	Result addOne(DesignFormData designFormData);

	/**
	 * 修改一条数据
	 *
	 * @param designFormData
	 * @return
	 */
	Result editOne(DesignFormData designFormData);

	/**
	 * 删除一条数据
	 *
	 * @param id
	 * @return
	 */
	Result deleteOne(String id, String token);

	/**
	 * 删除一条数据
	 *
	 * @param designFormData
	 * @return
	 */
	Result deleteOne(DesignFormData designFormData, String token);

	/**
	 * 通过主表ID删除数据
	 *
	 * @param asList
	 */
	public void deleteBatchMain(List<String> asList, String token);


}
